package com.tanxiuxin.YiWaiMai.common;

/**
 *   基于 ThreadLocal 封装的工具类，用于保存和获取当前登录用户的id
 *          ThreadLocal 是以线程为作用域，多个线程多次请求，不会互相影响
 */
public class BaseContext {

    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    public static void setCurrentId(Long id) {
        threadLocal.set(id);
    }

    public static Long getCurrentId(){
        return threadLocal.get();
    }
}
